import Taro, { Component } from "@tarojs/taro";
import {
  AtMessage,
} from "taro-ui";
import { View } from "@tarojs/components";
import {connect} from '@tarojs/redux'

import PlanNavBar from "../../components/PlanNavBar/planNavBar";
import CurrentPlanNotice from "../../components/CurrentPlanNotice/currentPlanNotice";
import PlanTab from "../../components/PlanTab/planTab";
import Modals from "../../components/Modals/modals";
import LoginModal from '../LoginModal/index'

import {get} from '../../utils/storage'

@connect(
  state=>state.user
)
class MainContent extends Component {
  onGetUserInfo = userInfo => {
    this.props.onGetUserInfo(userInfo.detail);
    this.props.onLoginSession();
  };
  render() {
    return (
      <View className='main-content'>
        <PlanNavBar />
        <AtMessage />
        <CurrentPlanNotice />
        {this.props.login? (
          <View>
            <PlanTab />
            <Modals />
          </View>
        ) :!get('login')? <LoginModal />:null}
      </View>
    );
  }
}
export default MainContent;
